import { get, post, login_post, del, put } from '../axios/axios.js'
import { MessageBox } from 'element-ui';
/* 新建考试页面 */
// 考试名称
const getTestName = ()=>{
	return get('v1/exam-name?no-page=1')
}

//调用试卷
const getTestCall = ()=>{
	return get('v1/exam?no-page=1')
}

//调用管理机构
const getManagement= ()=>{
	return get('v1/department?no-page=1')
}

//添加个人
const getUserList = (params)=>{
	return get('v1/user',params)
}
//提交新建
const postNewTest = (params) =>{
	return post('v1/test',params)
}

//编辑试卷
const editNewTest = (id) =>{
	return get(`v1/test/${id}`)
}

//保存编辑的试卷
const editSaveTest = (id,params) =>{
	return put('v1/test',id,params)
}
/* --------- */

/* 人员管理 */
//编辑
const editorUser = (id,params) =>{
	return put('v1/user',id,params)
}

//修改密码
const resetPassword= (id,params) =>{
	return post(`v1/user/reset/${id}`,params)
}
//获取单人信息
const getOneUser = (id) =>{
	return get(`v1/user/${id}`)
}

// 修改部门名称
const setDepName = (id,params) =>{
	return put(`v1/department`,id,params)
}
/* ----- */

//练习list
const getPracticeList = (query) =>{
	return get(`v1/test`,query)
}

//编辑标签
const editTagList = (id,params) =>{
	return put('v1/tag',id,params)
}

// //通过率
// const getChart1 = () =>{
// 	return get('v1/report/dept-pass')
// }
//
// //参与率
// const getChart2 = () =>{
// 	return get('v1/report/dept-enroll')
// }
//
// //排名
// const getChart3 = () =>{
// 	return get('v1/report/dept-rank')
// }

// 将上面三个的数据整合到一个接口
const get123Chart = () => {
	return get('v1/report/dept-chart')
}

const get345Chart = () =>{
	return get('v1/report/test-chart')
}
//错题统计
const getChart4= (query={}) =>{
	return get('v1/report/question-wrong',query)
}
export default{
	getTestName,
	getTestCall,
	getManagement,
	getUserList,
	postNewTest,
	editNewTest,
	editSaveTest,
	editorUser,
	resetPassword,
	getOneUser,
	setDepName,
	getPracticeList,
	editTagList,
	// getChart1,
	// getChart2,
	// getChart3,
	get123Chart,
	getChart4,
	get345Chart
}
